package com.sdgakj.rest;

import com.sdgakj.dto.base.ResResult;
import com.sdgakj.entity.User;
import com.sdgakj.service.person.PersonService;
import com.sdgakj.service.user.UserService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.util.JSONUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by win10 on 2017/5/24.
 */
@RestController()
@RequestMapping("/api/v1/person")
public class ShareListController {
    private static Logger logger = LoggerFactory.getLogger(User.class);

    @Autowired
    private UserService userService;
    @Autowired
    private PersonService personService;
    /**
     * 通过id查询用户个人信息
     * */
/*   @RequestMapping(value = "/details",method = RequestMethod.POST)
    public JSONObject getUserByDetails(@RequestParam(value = "id",defaultValue = "1") Long id){
        JSONObject result=new JSONObject();
        if(id==null){
            id=Long.parseLong("1");
        }
       try{
            User user=userService.getUserById(id);
            result.put("user",user);
       }catch (Exception e){

       }
        return result;
    }*/
/*
*   删除 person 用户
* */
    @RequestMapping(value = "/delete",method = RequestMethod.GET)
    public ResResult deletePerson(@RequestParam(value = "id", defaultValue = "0") Long id) {
        ResResult result = new ResResult();
        personService.deletePersonById(id);
        return result;
    }
}

